package com.cloud.dict.runner;

import com.cloud.dict.service.DictionaryService;
import com.cloud.dict.utils.ApplicationContextUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Order(value=1)
@Slf4j
public class DictionaryRunner implements CommandLineRunner {

    @Override
    public void run(String... args) throws Exception {
        log.info("Init dictionary *******");
        DictionaryService dictionaryService = (DictionaryService)ApplicationContextUtils.getBean(DictionaryService.class);
        dictionaryService.refreshCache();
    }

}
